package com.tanhua.sso.controller;

import com.tanhua.sso.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("user")
public class SmsController {

    @Autowired
    private SmsService smsService;

    /**
     * 发送验证码接口
     */
    @PostMapping("login")
    public ResponseEntity<Object> sendCheckCode(@RequestBody Map<String, Object> param) {
        String phone = String.valueOf(param.get("phone"));
        this.smsService.sendCheckCode(phone);
        return ResponseEntity.ok(null);
    }

}
